package com.yksj.healthtalk.adapter;

import java.util.List;
import java.util.Map;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yksj.healthtalk.ui.R;

/**
 * 省
 * 
 * @author Administrator
 * 
 */
public class DoctorProPopAdapter extends BaseAdapter {

	private Context context;
	private List<Map<String, String>> list;
	private int mProvincePosition = -1; // key 省 value code
	// pop_List_Position
	public DoctorProPopAdapter(Context context, List<Map<String, String>> list) {
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}
	
	public  void setSelectPosition(int mProvincePosition){
		this.mProvincePosition  = mProvincePosition;
	}
	
	public int getSelectPosition(){
		return mProvincePosition;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView tv = new TextView(context);
//		tv.setPadding(5, 20, 5, 20);
		tv.setGravity(Gravity.CENTER);
		tv.setTextSize(15);
		tv.setText(list.get(position).get("name").toString());
		if (mProvincePosition == position) {
			tv.setTextColor(context.getResources().getColorStateList(
					R.color.tab_txt_orange));
		}else {
			tv.setTextColor(Color.BLACK);
		}
		
		tv.setTag(Integer.valueOf(list.get(position).get("code")));
		return tv;
	}

}
